package com.singzi.leetcode.jianzhiOffer;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Stack;

public class T0046 {
}
class Solution0046 {
    public int translateNum(int num) {


        HashSet<Character> hashSet = new HashSet<>();

        if(num>0 && num < 9) return 1;
        else if(num < 26) return 2;
        Stack<Integer> stack = new Stack<>();

        while(num > 0){
            stack.push(num%10);
            num = num%10;
        }
        int dp[] = new int[3];
        dp[0] = stack.pop();
        dp[1] = stack.pop();
        if(dp[1]*10 + dp[0] > 25) {
            dp[1] = 1;
        }
        dp[0] = 1;

        while (!stack.empty()){
            dp[2] = stack.pop();
            if(dp[2]*10 + dp[1] > 25) {
                dp[2] = dp[1];
            }
            else {
                dp[2] = dp[0] + dp[1];
            }
            dp[0] = dp[1];
            dp[1] = dp[2];
        }
       for (int i = 0; i < 100; i++) {
           outerLoop: for (int i2 = 0; i2 < 100; i2++) {


              for (int i1 = 0; i1 < 50; i1++) {
                if(i1==2){
                    dp[2] = 10;
                    break outerLoop;
                }

            }
        }
       }
        return dp[2];
    }

}